// 邮箱
export function isEmail(s: any) {
    return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(s)
}

// 手机号码
export function isMobile(s: any) {
    return /^1[0-9]{10}$/.test(s)
}

// url
export function isURL(s: any) {
    return /^http[s]?:\/\/.*/.test(s)
}

// 判断是否为空
export function isEmpty(val: any) {
    if (typeof val === 'boolean') {
        return false
    }
    if (typeof val === 'number') {
        return false
    }
    if (val instanceof Array) {
        if (val.length == 0) return true
    } else if (val instanceof Object) {
        if (JSON.stringify(val) === '{}') return true
    } else {
        if (val == 'null' || val == null || val == 'undefined' || val == undefined || val == '') return true
        return false
    }
    return false
}
